<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.9/vue.js"></script>
</head>

<body>
    <div id="app">
        <p v-html="message"></p>
        <p v-text="flag?'开关打开':'开关关闭' "></p>
        <button @click="ChangeState">点击</button>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       </button>
    </div>
    <script>
        const vm = new Vue({
            el: "#app",
            data: {
                message: '<h2 style="color:skyblue">今天星期一</h2>',
                flag: true
            },
            methods: {
                ChangeState() {
                    if (this.flag) {
                        this.flag = false
                    } else {
                        this.flag = true
                    }
                }
            }
        })
    </script>
</body>

</html>